package com.dot.dominion.boardview;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class BoardAdapter extends BaseAdapter {
	private Context mContext;
	private Integer[] mImages;
	
	public BoardAdapter(Context context, Integer[] thumbImages) {
		mContext = context;
		mImages = thumbImages;
	}
	
	public int getCount() {
		return mImages.length;
	}
	
	public Object getItem(int position) {
		return null;
	}
	
	public long getItemId(int position) {
		return mImages[position].longValue();
	}
	
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView = null;
		
		if( convertView == null ) {
			imageView = new ImageView(mContext);
			//imageView.setLayoutParams(new GridView.LayoutParams(85,85));
			imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
			//imageView.setPadding(5, 5, 5, 5);
		}
		else {
			imageView = (ImageView) convertView;
		}
		
		imageView.setImageResource(mImages[position]);
		
		return imageView;
	}
}
